package com.liuyi.netty.im.lychat.modular.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.liuyi.netty.im.commons.codes.CodeConst;
import com.liuyi.netty.im.lychat.modular.enums.MessageReminding;
import com.liuyi.netty.im.server.util.ImHelp;
import com.liuyi.rapid.develop.mybatis.plus.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Transient;

/**
 * <p>
 * 用户好友表
 * </p>
 *
 * @author mybatis-plus
 * @since 2021-12-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tb_user_friend")
@ApiModel(value = "UserFriend对象", description = "用户好友表")
public class UserFriend extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "逻辑删除，1未删除，时间戳删除")
    private Long del;

    @ApiModelProperty(value = "用户id")
    private String userId;

    @ApiModelProperty(value = "好友id")
    private String friendUserId;

    @ApiModelProperty(value = "好友备注")
    private String friendMemo;

    @ApiModelProperty(value = "消息提醒")
    private MessageReminding messageReminding;

    @ApiModelProperty(value = "好友头像")
    @Transient
    @TableField(exist = false)
    private String friendHead;

    public String getSessionId() {
        return ImHelp.sessionId(CodeConst.SessionType.C2C, friendUserId);
    }


    public static final String ID = "id";

    public static final String DEL = "del";

    public static final String USER_ID = "user_id";

    public static final String FRIEND_USER_ID = "friend_user_id";

    public static final String FRIEND_MEMO = "friend_memo";

    public static final String MESSAGE_REMINDING = "message_reminding";

}
